<extend name="Public/base" />
<block name="body">
     <style type="text/css">
        a{
            cursor: pointer;
        }
        .hover{
            background-color:white !important;
            color:black !important;
        }

        .user-center{height: 150px;}
        .sleft_top{float: left;}
        .sleft_bottom{float: left;margin-left: 80px;}
        .search-input_one{width: 300px;height: 32px;margin-left: 10px;}
        .search-input_two{width: 200px;height: 32px;margin-left: 10px;}
        .user-down{float: left;margin-top: 40px;margin-right: 250px;}
        .sous{}
        .user-down_left{float:left;}
        .search-input_three{height: 32px;width: 136px;}
        .search-input_four{height: 32px;width: 136px;}
        .user-right{float: left;margin-left: 80px;}
        .search-input_five{width: 200px;height: 32px;}
        hr{margin-top: -13px;margin-bottom: 10px;}
         #search{float: right;text-align: center;padding-right: 31px;padding-left: 33px;font-size: 15px;}

    </style>
    <!-- 高级搜索 -->
    <div class="user-center">
        <div >
            <div class="sleft_top">订单账号：
                <input type="text" name="order_number" class="search-input_one" value="{:I('order_number')}" placeholder="订单单号">
            </div>
            <div class="sleft_bottom">手机联系人：
                <input type="text" name="phone_number" class="search-input_two" value="{:I('phone_number')}" placeholder="联系人手机">
            </div>
        </div>
        <div >
            <div class="user-down">
                <div class="user-down_left">下单时间：&nbsp&nbsp&nbsp
                    <input type="text" name="order_time" class="search-input_three" value="{:I('order_time')}" placeholder="">&nbsp至&nbsp
                    <input type="text" name="order_time" class="search-input_four" value="{:I('order_time')}" placeholder="">
                </div>
                <div class="user-right">用户ID：&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                    <input type="text" name="user_id" class="search-input_five" value="{:I('user_id')}" placeholder="用户ID">
                </div>
                <div class="sous" >
                    <a class="btn" id='search' url="admin.php?s=/Order/ordinary.html">筛选</a>
                </div>
            </div>
        </div>
    </div>
    <hr>
    <!-- 数据列表 -->
    <div class="table-striped－main">
        <ul>
            <li><a href="admin.php?s=/Order/ordinary/status/2.html"<eq name="all" value="1">class='hover'</eq>>全部</a></li>
            <li><a href="admin.php?s=/Order/ordinary/status/2.html"<eq name="pending_payment" value="2">class='hover'</eq>>待付款</a></li>
            <li><a href="admin.php?s=/Order/ordinary/status/3.html" <eq name="to_be_shipped" value="3">class='hover'</eq>>待发货</a></li>
            <li><a href="admin.php?s=/Order/ordinary/status/4.html" <eq name="already_shipped" value="4">class='hover'</eq>>已发货</a></li>
            <li><a href="admin.php?s=/Order/ordinary/status/5.html" <eq name="evaluated" value="5">class='hover'</eq>>待评价</a></li>
            <li><a href="admin.php?s=/Order/ordinary/status/1.html" <eq name="completed" value="6">class='hover'</eq>>已完成</a></li>
            <li><a href="admin.php?s=/Order/ordinary/status/2.html" <eq name="return" value="7">class='hover'</eq>>退款货款</a></li>
            <!--<li><a href="admin.php?s=/Order/orderretrun.html">退货退款</a></li>-->
            <li><a href="admin.php?s=/Order/ordinary/status/10.html" <eq name="canceled" value="10">class='hover'</eq>>已取消</a></li>
        </ul>
    </div>
    <div class="table-striped" style="margin-top:10px;">
        <notempty name="_list">
            <volist name="_list" id="vo"  key="n">
                <div class="item-box">
                    <div class="order-top">
                        <div class="col-sm-4"><label>订单单号：</label>{$vo.order_number}</div>
                        <div class="col-sm-4"><label>用户ID：</label>{$vo.user_id}</div>
                        <div class="col-sm-4"><label>下单时间：</label>{$vo.order_time}</div>
                    </div>
                    <div class="item-table">
                        <table>
                            <!-- 表头 -->
                            <tr>
                                <th>商品信息 </th>
                                <th rowspan="2" class="no-padding">
                                <th>商品编码</th>
                                <th>数量</th>
                                <th>实付款</th>
                                <th>收货信息</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            <tr>
                                <td><img src="{$vo.img_path}" />{$vo.information}</td>
                                <td>{$vo.code}</td>
                                <td>{$vo.number}</td>
                                <td>{$vo.payment}</td>
                                <td>{$vo.receiptinfo.province}{$vo.receiptinfo.city}{$vo.receiptinfo.area}{$vo.receiptinfo.address}</td>
                                <td> <a href="admin.php?s=/Oder/ordinary.html">待付款</a></td>
                                <td><input class="f3"name="title" type="button" onclick="f4()"value="平台备注"></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </volist>
            <else/>
            <td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
        </notempty>
        <div class="page">
            {$_page}
        </div>
        <div class="modal" style="display:none;">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-express">
                        <div class="modal-header"><button type="button" class="close modal-close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                            <h4 class="modal-title" id="gridModalLabel">请为该订单填写物流单号</h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-item">
                                <span class="item_name" style="margin-left: -48px">快递公司：</span>
                                <select style="margin-left: 15px" class="selection_1 textbox_296" id="express_type">
                                    <option value="1">顺丰</option>
                                    <option value="2">深通</option>
                                    <option value="3">圆通</option>
                                    <option value="4">韵达</option>
                                    <option value="5">大丰</option>
                                    <option value="6">诚信</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-item">
                            <span class="item_name" style="margin-left: -48px">快递单号：</span>
                            <input class="textbox_296 " placeholder="快递单号..." type="text" style="margin-left: 15px" id="express_code" />
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-return modal-close" data-dismiss="modal" aria-label="Close">取消</button>
                            <button type="button" class="btn btn-primary submit-btn-express">确定</button>
                            <input value="" type="hidden" id="invest_code">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 平台备注 -->
    <div class="modal" style="display: none;" >
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button aria-label="Close" data-dismiss="modal" class="close modal-close" type="button"><span aria-hidden="true">×</span></button>
                    <h4 id="beizhu" class="modal-title">平台备注</h4></div>
                <div class="modal-body">
                    <div class="see">
                        <input type="text"style="width: 500px;height: 200px;">
                    </div>
                </div>
                <div class="modal-footer">
                    <button aria-label="Close" data-dismiss="modal" class="btn btn-return xy" type="button">取消</button>
                    <button class="btn btn-primary submit-btn modal-submit" type="button">完成</button></div>
            </div>
        </div>
    </div>

</block>
<block name="style">
    <link href="__PUBLIC__/static/jquery-datetimepicker/jquery-datetimepicker.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" href="__PUBLIC__/static/kindeditor/default/default.css" />
</block>
<block name="script">
    <script type="text/javascript" src="__PUBLIC__/static/jquery-datetimepicker/jquery-datetimepicker.js"></script>
    <script type="text/javascript" charset="utf-8">

        $("#search_data").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //日期时间插件
        $('.date_picker').datetimepicker({
            lang:'ch',
            format:'Y-m-d H:00',
            timepicker:true,
            allowBlank:true
        });
        //导航高亮
        highlight_subnav('{:U('Order/order')}');

        $(".open-express").click(function(){
            var id = $(this).attr("code");
            $("#invest_code").val(id);
            $(".modal").show();
        })
        $('.submit-btn-express').on('click', function(){
            $(".modal").hide();
            var invest_id = $("#invest_code").val();
            var express_code = $("#express_code").val();
            var express_type = $("#express_type").val();
            $.post(
                    'admin.php?s=/Order/changeexpress.html',
                    {
                        id:invest_id,express_code:express_code,express_type:express_type
                    },
                    function(responed){
                        alert("新增成功");
                        location.reload();
                    }
            );
            return false;
        });
        $(' .modal-close').on('click', function(){
            $(".modal").hide();
        });
        $(function(){
            $('body').on('click', '.open-html', function(event){
                var id = $(this).attr("code");
                event.stopPropagation();
                var url = $(this).attr('href');
                if( !url )      return  false;
                var tips =  '评论信息',
                        button = $(this).hasClass('open-delivery') ? true : false;
                load_html({
                    url: url,
                    title: tips,
                    button: button
                });
                return false;

            });
        });
        $(".cacelorder").click(function(){
            var id = $(this).attr("code");
            if(confirm("确定取消订单吗")){
                $.post(
                        'admin.php?s=/Order/cancelorder.html',
                        {
                            data: "",id:id
                        },
                        function(responed){
                            alert("取消成功");
                            location.reload();
                        }
                );
            }
        })
        $(".changeamount").click(function(){
            $(this).parent().css("background-color","yellow")
            var id = $(this).attr("code");
            var name=prompt("请输入修改后的价格","")
            if (name!=null && name!="")
            {
                $.post(
                        'admin.php?s=/Order/changeamount.html',
                        {
                            amount: name,id:id
                        },
                        function(responed){
                            alert("修改成功");
                            location.reload();
                        }
                );
            }
        })


    </script>
    <script type="text/javascript" charset="utf-8">
        onload = function ()
        {
            setInterval (function ()
            {
                var date = new Date ();
//				txt.value = date.toLocaleDateString();
            });

        }

        function f4(){
            $(".modal").show();
        }
        $(".modal-close").click(function(){
            $(".modal").hide();
        })

    </script>
</block>